package com.geek.javase.ch18.videodemo.base64.urldemo;

import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;

/*
 *@Date 2025/11/6
 *@Author wangpeng
 *@Description
 * Servlet Cookie数据传递
 */
public class URLEncodeDecode {
    public static void main(String[] args) throws UnsupportedEncodingException {
        //URLEncode 编码
        String encode = URLEncoder.encode("你好，世界", "UTF-8");
        System.out.println(encode);
        //URLDecode 解码
        String decode = URLDecoder.decode(encode, "UTF-8");
        System.out.println(decode);
    }
}
